home *** CD-ROM | disk | FTP | other *** search
/ The CICA Windows Explosion! / The CICA Windows Explosion! - Disc 2.iso / programr / rsxwdk2s.zip / RSXWDK / LIBSRC / WINIO / ARGCARGV.C next >
C/C++ Source or Header  |  1994-12-21  |  1KB  |  64 lines

  1. /*
  2. argcargv.c -- see MSJ, May 1991, pp. 135-136
  3. */
  4.  
  5. #define NOGDI
  6. #define NOUSER
  7. #define NOKERNEL
  8.  
  9. #define STRICT
  10. #include <windows.h>
  11. #include <stdlib.h>
  12. #include <string.h>
  13. #include <sys/doscalls.h>
  14. #include "winio.h"
  15.  
  16. #define argc __argc
  17. #define argv __argv
  18. extern int __argc;
  19. extern char **__argv;
  20.  
  21. extern int winio_main(int argc, char **argv, char **envp);
  22.  
  23. int winio_read(int handle, void *buf, int size)
  24. {
  25.     int i;
  26.     char *b = buf;
  27.  
  28.     *b = 0;
  29.     winio_gets(buf);
  30.     i = strlen(buf);
  31.     b[i++]='\n';
  32.     return i;
  33. }
  34.  
  35. void         winio_addchars(void *, unsigned);
  36.  
  37. int winio_write(int handle, void *buf, int size)
  38. {
  39.     winio_addchars(buf, size);
  40.     return size;
  41. }
  42.  
  43. HINSTANCE _hinst;
  44. HINSTANCE _hprevinst;
  45. LPCSTR _lpcmdline;
  46. int _ncmdshow;
  47.  
  48. INT PASCAL WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
  49.     LPSTR lpCmdLine, INT nCmdShow)
  50. {
  51.     _hinst = hInstance;
  52.     _hprevinst = hPrevInstance;
  53.     _lpcmdline = lpCmdLine;
  54.     _ncmdshow = nCmdShow;
  55.  
  56.     if (! winio_init(hInstance, hPrevInstance, nCmdShow, 0))
  57.     return 1;
  58.  
  59.     _console_read = winio_read;
  60.     _console_write = winio_write;
  61.  
  62.     return winio_main(argc, argv, environ);
  63. }
  64.